package com.xgr.wonderful.activity.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * BaseHomeActivity与BaseHomeFragment之间的关系是从
 * BaseHomeFragment继承的子类被从BaseHomeActivity继承的子类展示
 * @author lsj
 */

public abstract class BaseHomeFragment extends BaseFragment{
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View contentView = inflater.inflate(getLayoutId(),container,false);
		findViews(contentView);
		setupViews(savedInstanceState);
		setListener();
		return contentView;
	}

	/**
	 * 子类继承用于获取自己的layout布局ID
	 * @return
	 */
	protected abstract int getLayoutId();
	
	/**
	 * 子类继承用于构建自己的各个控件
	 * @param view
	 */
	protected abstract void findViews(View view);
	
	/**
	 * 子类继承用于设置自己的各个控件的内容
	 * @param bundle
	 */
	protected abstract void setupViews(Bundle bundle);

	/**
	 * 子类继承用于设置自己的各个控件的监听对象
	 */
	protected abstract void setListener();

}
